package zhuhai.tedu.parttimess.utils;

public class ExcelUtils {
    /**判断是否为2003*/
    public static boolean isExcel2003(String filePath)  {
        String format = filePath.substring(filePath.length()-4,filePath.length());
        return format.matches("^\\.(?i)(xls)$");
    }

    /**判断是否为2007*/
    public static boolean isExcel2007(String filePath)  {
        String format = filePath.substring(filePath.length()-5,filePath.length());
        return format.matches("^\\.(?i)(xlsx)$");
    }

    /**判断是否为Excel格式*/
    public static boolean validateExcel(String filePath){
        if (filePath == null || !(isExcel2003(filePath) || isExcel2007(filePath))){
            return false;
        }
        return true;
    }
}
